SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBPrimaryKey]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBPrimaryKey](
	[PrimaryKeyID] [uniqueidentifier] NOT NULL,
	[TableID] [uniqueidentifier] NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[PrimaryKeyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMLookupList]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMLookupList](
	[LookupListID] [uniqueidentifier] NOT NULL,
	[Generated] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[LookupListID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMLookupListBusinessObject]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMLookupListBusinessObject](
	[BusinessObjectLookupListID] [uniqueidentifier] NOT NULL,
	[LookupClassName] [varchar](50) NOT NULL,
	[Assembly] [varchar](50) NOT NULL,
	[Criteria] [varchar](50) NULL,
	[Sort] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[BusinessObjectLookupListID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMLookupListDatabase]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMLookupListDatabase](
	[DatabaseLookupListID] [uniqueidentifier] NOT NULL,
	[Sql] [varchar](50) NOT NULL,
	[TimeOut] [varchar](50) NOT NULL,
	[LookupClassName] [varchar](50) NOT NULL,
	[Assembly] [varchar](50) NOT NULL,
PRIMARY KEY CLUSTERED
(
	[DatabaseLookupListID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMLookupListSimple]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMLookupListSimple](
	[SimpleLookupListID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[SimpleLookupListID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMPropRule]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMPropRule](
	[PropRuleID] [uniqueidentifier] NOT NULL,
	[PropRuleName] [varchar](50) NOT NULL,
	[Message] [varchar](50) NULL,
	[Generated] [bit] NOT NULL,
	[Class] [varchar](50) NULL,
	[Assembly] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[PropRuleID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMSolution](
	[SolutionID] [uniqueidentifier] NOT NULL,
	[SolutionName] [varchar](100) NOT NULL,
	[DefaultAssemblyID] [uniqueidentifier] NOT NULL,
	[HabaneroDllPath] [varchar](50) NULL,
	[TableNamePrefix] [varchar](50) NULL,
	[TableNameSuffix] [varchar](50) NULL,
	[PascalCase] [bit] NULL,
	[SolutionDirectory] [varchar](50) NULL,
	[UIProjectName] [varchar](50) NULL,
	[BOProjectName] [varchar](50) NULL,
	[LogicProjectName] [varchar](50) NULL,
	[BaseProjectName] [varchar](50) NULL,
	[Generated] [bit] NULL,
	[BOTestProjectName] [varchar](50) NULL,
	[UITestProjectName] [varchar](50) NULL,
	[SolutionDescription] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[SolutionID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMSolution_AK1_SolutionName] UNIQUE NONCLUSTERED
(
	[SolutionName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[ReverseEngineeringSettings]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ReverseEngineeringSettings](
	[ReverseEngineeringSettingsID] [uniqueidentifier] NOT NULL,
	[ImportTables] [bit] NULL,
	[ImportViews] [bit] NULL,
	[TableNameFilter] [varchar](50) NULL,
	[ViewNameFilter] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[ReverseEngineeringSettingsID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Entity]    Script Date: 05/19/2009 08:41:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Entity]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Entity](
	[EntityID] [uniqueidentifier] NOT NULL,
	[DMClassID] [uniqueidentifier] NOT NULL,
	[field1] [varchar](255) NULL,
	[field2] [varchar](255) NULL,
	[field3] [varchar](255) NULL,
	[field4] [varchar](255) NULL,
	[field5] [varchar](255) NULL,
	[field6] [varchar](255) NULL,
	[field7] [varchar](255) NULL,
	[field8] [varchar](255) NULL,
	[field9] [varchar](255) NULL,
	[field10] [varchar](255) NULL,
	[field11] [varchar](255) NULL,
	[field12] [varchar](255) NULL,
	[field13] [varchar](255) NULL,
	[field14] [varchar](255) NULL,
	[field15] [varchar](255) NULL,
	[field16] [varchar](255) NULL,
	[field17] [varchar](255) NULL,
	[field18] [varchar](255) NULL,
	[field19] [varchar](255) NULL,
	[field20] [varchar](255) NULL,
	[field21] [varchar](255) NULL,
	[field22] [varchar](255) NULL,
	[field23] [varchar](255) NULL,
	[field24] [varchar](255) NULL,
	[field25] [varchar](255) NULL,
	[field26] [varchar](255) NULL,
	[field27] [varchar](255) NULL,
	[field28] [varchar](255) NULL,
	[field29] [varchar](255) NULL,
	[field30] [varchar](255) NULL,
	[field31] [varchar](255) NULL,
	[field32] [varchar](255) NULL,
	[field33] [varchar](255) NULL,
	[field34] [varchar](255) NULL,
	[field35] [varchar](255) NULL,
	[field36] [varchar](255) NULL,
	[field37] [varchar](255) NULL,
	[field38] [varchar](255) NULL,
	[field39] [varchar](255) NULL,
	[field40] [varchar](255) NULL,
	[field41] [varchar](255) NULL,
	[field42] [varchar](255) NULL,
	[field43] [varchar](255) NULL,
	[field44] [varchar](255) NULL,
	[field45] [varchar](255) NULL,
	[field46] [varchar](255) NULL,
	[field47] [varchar](255) NULL,
	[field48] [varchar](255) NULL,
	[field49] [varchar](255) NULL,
	[field50] [varchar](255) NULL,
	[field51] [varchar](255) NULL,
	[field52] [varchar](255) NULL,
	[field53] [varchar](255) NULL,
	[field54] [varchar](255) NULL,
	[field55] [varchar](255) NULL,
	[field56] [varchar](255) NULL,
	[field57] [varchar](255) NULL,
	[field58] [varchar](255) NULL,
	[field59] [varchar](255) NULL,
	[field60] [varchar](255) NULL,
	[field61] [varchar](255) NULL,
	[field62] [varchar](255) NULL,
	[field63] [varchar](255) NULL,
	[field64] [varchar](255) NULL,
	[field65] [varchar](255) NULL,
	[field66] [varchar](255) NULL,
	[field67] [varchar](255) NULL,
	[field68] [varchar](255) NULL,
	[field69] [varchar](255) NULL,
	[field70] [varchar](255) NULL,
	[field71] [varchar](255) NULL,
	[field72] [varchar](255) NULL,
	[field73] [varchar](255) NULL,
	[field74] [varchar](255) NULL,
	[field75] [varchar](255) NULL,
	[field76] [varchar](255) NULL,
	[field77] [varchar](255) NULL,
	[field78] [varchar](255) NULL,
	[field79] [varchar](255) NULL,
	[field80] [varchar](255) NULL,
	[field81] [varchar](255) NULL,
	[field82] [varchar](255) NULL,
	[field83] [varchar](255) NULL,
	[field84] [varchar](255) NULL,
	[field85] [varchar](255) NULL,
	[field86] [varchar](255) NULL,
	[field87] [varchar](255) NULL,
	[field88] [varchar](255) NULL,
	[field89] [varchar](255) NULL,
	[field90] [varchar](255) NULL,
	[field91] [varchar](255) NULL,
	[field92] [varchar](255) NULL,
	[field93] [varchar](255) NULL,
	[field94] [varchar](255) NULL,
	[field95] [varchar](255) NULL,
	[field96] [varchar](255) NULL,
	[field97] [varchar](255) NULL,
	[field98] [varchar](255) NULL,
	[field99] [varchar](255) NULL,
	[field100] [varchar](255) NULL,
	[field101] [varchar](255) NULL,
	[field102] [varchar](255) NULL,
	[field103] [varchar](255) NULL,
	[field104] [varchar](255) NULL,
	[field105] [varchar](255) NULL,
	[field106] [varchar](255) NULL,
	[field107] [varchar](255) NULL,
	[field108] [varchar](255) NULL,
	[field109] [varchar](255) NULL,
	[field110] [varchar](255) NULL,
	[field111] [varchar](255) NULL,
	[field112] [varchar](255) NULL,
	[field113] [varchar](255) NULL,
	[field114] [varchar](255) NULL,
	[field115] [varchar](255) NULL,
	[field116] [varchar](255) NULL,
	[field117] [varchar](255) NULL,
	[field118] [varchar](255) NULL,
	[field119] [varchar](255) NULL,
	[field120] [varchar](255) NULL,
	[field121] [varchar](255) NULL,
	[field122] [varchar](255) NULL,
	[field123] [varchar](255) NULL,
	[field124] [varchar](255) NULL,
	[field125] [varchar](255) NULL,
	[field126] [varchar](255) NULL,
	[field127] [varchar](255) NULL,
	[field128] [varchar](255) NULL,
	[field129] [varchar](255) NULL,
	[field130] [varchar](255) NULL,
	[field131] [varchar](255) NULL,
	[field132] [varchar](255) NULL,
	[field133] [varchar](255) NULL,
	[field134] [varchar](255) NULL,
	[field135] [varchar](255) NULL,
	[field136] [varchar](255) NULL,
	[field137] [varchar](255) NULL,
	[field138] [varchar](255) NULL,
	[field139] [varchar](255) NULL,
	[field140] [varchar](255) NULL,
	[field141] [varchar](255) NULL,
	[field142] [varchar](255) NULL,
	[field143] [varchar](255) NULL,
	[field144] [varchar](255) NULL,
	[field145] [varchar](255) NULL,
	[field146] [varchar](255) NULL,
	[field147] [varchar](255) NULL,
	[field148] [varchar](255) NULL,
	[field149] [varchar](255) NULL,
	[field150] [varchar](255) NULL,
	[field151] [varchar](255) NULL,
	[field152] [varchar](255) NULL,
	[field153] [varchar](255) NULL,
	[field154] [varchar](255) NULL,
	[field155] [varchar](255) NULL,
	[field156] [varchar](255) NULL,
	[field157] [varchar](255) NULL,
	[field158] [varchar](255) NULL,
	[field159] [varchar](255) NULL,
	[field160] [varchar](255) NULL,
	[field161] [varchar](255) NULL,
	[field162] [varchar](255) NULL,
	[field163] [varchar](255) NULL,
	[field164] [varchar](255) NULL,
	[field165] [varchar](255) NULL,
	[field166] [varchar](255) NULL,
	[field167] [varchar](255) NULL,
	[field168] [varchar](255) NULL,
	[field169] [varchar](255) NULL,
	[field170] [varchar](255) NULL,
	[field171] [varchar](255) NULL,
	[field172] [varchar](255) NULL,
	[field173] [varchar](255) NULL,
	[field174] [varchar](255) NULL,
	[field175] [varchar](255) NULL,
	[field176] [varchar](255) NULL,
	[field177] [varchar](255) NULL,
	[field178] [varchar](255) NULL,
	[field179] [varchar](255) NULL,
	[field180] [varchar](255) NULL,
	[field181] [varchar](255) NULL,
	[field182] [varchar](255) NULL,
	[field183] [varchar](255) NULL,
	[field184] [varchar](255) NULL,
	[field185] [varchar](255) NULL,
	[field186] [varchar](255) NULL,
	[field187] [varchar](255) NULL,
	[field188] [varchar](255) NULL,
	[field189] [varchar](255) NULL,
	[field190] [varchar](255) NULL,
	[field191] [varchar](255) NULL,
	[field192] [varchar](255) NULL,
	[field193] [varchar](255) NULL,
	[field194] [varchar](255) NULL,
	[field195] [varchar](255) NULL,
	[field196] [varchar](255) NULL,
	[field197] [varchar](255) NULL,
	[field198] [varchar](255) NULL,
	[field199] [varchar](255) NULL,
	[field200] [varchar](255) NULL,
	[field201] [varchar](255) NULL,
	[field202] [varchar](255) NULL,
	[field203] [varchar](255) NULL,
	[field204] [varchar](255) NULL,
	[field205] [varchar](255) NULL,
	[field206] [varchar](255) NULL,
	[field207] [varchar](255) NULL,
	[field208] [varchar](255) NULL,
	[field209] [varchar](255) NULL,
	[field210] [varchar](255) NULL,
	[field211] [varchar](255) NULL,
	[field212] [varchar](255) NULL,
	[field213] [varchar](255) NULL,
	[field214] [varchar](255) NULL,
	[field215] [varchar](255) NULL,
	[field216] [varchar](255) NULL,
	[field217] [varchar](255) NULL,
	[field218] [varchar](255) NULL,
	[field219] [varchar](255) NULL,
	[field220] [varchar](255) NULL,
	[field221] [varchar](255) NULL,
	[field222] [varchar](255) NULL,
	[field223] [varchar](255) NULL,
	[field224] [varchar](255) NULL,
	[field225] [varchar](255) NULL,
	[field226] [varchar](255) NULL,
	[field227] [varchar](255) NULL,
	[field228] [varchar](255) NULL,
	[field229] [varchar](255) NULL,
	[field230] [varchar](255) NULL,
	[field231] [varchar](255) NULL,
	[field232] [varchar](255) NULL,
	[field233] [varchar](255) NULL,
	[field234] [varchar](255) NULL,
	[field235] [varchar](255) NULL,
	[field236] [varchar](255) NULL,
	[field237] [varchar](255) NULL,
	[field238] [varchar](255) NULL,
	[field239] [varchar](255) NULL,
	[field240] [varchar](255) NULL,
	[field241] [varchar](255) NULL,
	[field242] [varchar](255) NULL,
	[field243] [varchar](255) NULL,
	[field244] [varchar](255) NULL,
	[field245] [varchar](255) NULL,
	[field246] [varchar](255) NULL,
	[field247] [varchar](255) NULL,
	[field248] [varchar](255) NULL,
	[field249] [varchar](255) NULL,
	[field250] [varchar](255) NULL,
	[field251] [varchar](255) NULL,
	[field252] [varchar](255) NULL,
	[field253] [varchar](255) NULL
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[transactionlogentry]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[transactionlogentry](
	[TransactionSequenceNo] [int] IDENTITY(1,1) NOT NULL,
	[DateTimeUpdated] [datetime] NULL,
	[WindowsUser] [varchar](255) NULL,
	[LogonUser] [varchar](255) NULL,
	[MachineName] [varchar](255) NULL,
	[BusinessObjectTypeName] [varchar](255) NULL,
	[CRUDAction] [varchar](255) NULL,
	[DirtyXML] [varchar](50) NULL,
	[BusinessObjectToString] [varchar](255) NULL,
PRIMARY KEY CLUSTERED
(
	[TransactionSequenceNo] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[TypeMapping]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[TypeMapping](
	[TypeMappingID] [uniqueidentifier] NOT NULL,
	[FromType] [varchar](50) NOT NULL,
	[ToType] [varchar](50) NOT NULL,
PRIMARY KEY CLUSTERED
(
	[TypeMappingID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[RecentSolution]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[RecentSolution](
	[RecentSolutionID] [uniqueidentifier] NOT NULL,
	[Solution1ID] [uniqueidentifier] NULL,
	[Solution2ID] [uniqueidentifier] NULL,
	[Solution3ID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[RecentSolutionID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIFormInfo]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIFormInfo](
	[UIFormID] [uniqueidentifier] NOT NULL,
	[Width] [int] NOT NULL,
	[Height] [int] NOT NULL,
	[Title] [varchar](50) NULL,
	[Generated] [bit] NOT NULL,
	[UIViewID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIFormID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridFilter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIGridFilter](
	[UIGridFilterID] [uniqueidentifier] NOT NULL,
	[UIGridID] [uniqueidentifier] NOT NULL,
	[Generated] [bit] NOT NULL,
	[FilterMode] [varchar](50) NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIGridFilterID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridInfo]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIGridInfo](
	[UIGridID] [uniqueidentifier] NOT NULL,
	[SortColumn] [varchar](50) NULL,
	[Generated] [bit] NOT NULL,
	[UIViewID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIGridID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DatabaseConnectionInfo]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DatabaseConnectionInfo](
	[DatabaseConnectionID] [uniqueidentifier] NOT NULL,
	[Vendor] [varchar](50) NOT NULL,
	[Server] [varchar](50) NULL,
	[Port] [varchar](50) NULL,
	[Database] [varchar](50) NULL,
	[UserName] [varchar](50) NULL,
	[Password] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[DatabaseConnectionID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBDatabase]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBDatabase](
	[DatabaseID] [uniqueidentifier] NOT NULL,
	[DatabaseName] [varchar](255) NOT NULL,
	[Catalog] [varchar](50) NULL,
	[Schema] [varchar](50) NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[DatabaseID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DBDatabase_AK1_DatabaseName] UNIQUE NONCLUSTERED
(
	[DatabaseName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBPrimaryKeyColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBPrimaryKeyColumn](
	[PrimaryKeyID] [uniqueidentifier] NOT NULL,
	[ColumnID] [uniqueidentifier] NOT NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[ColumnID] ASC,
	[PrimaryKeyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMListItem]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMListItem](
	[ListItemID] [uniqueidentifier] NOT NULL,
	[Value] [varchar](50) NOT NULL,
	[Display] [varchar](50) NOT NULL,
	[Generated] [bit] NOT NULL,
	[SimpleLookupListID] [uniqueidentifier] NOT NULL,
	[Description] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[ListItemID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMPropRuleParameter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMPropRuleParameter](
	[PropRuleParameterID] [uniqueidentifier] NOT NULL,
	[RuleID] [uniqueidentifier] NULL,
	[KeyName] [varchar](50) NOT NULL,
	[Value] [varchar](50) NULL,
	[PropRuleID] [uniqueidentifier] NOT NULL,
	[Generated] [bit] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[PropRuleParameterID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMPropertyType]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMPropertyType](
	[PropertyTypeName] [varchar](50) NOT NULL,
	[AssemblyName] [varchar](50) NOT NULL,
	[PropertyTypeID] [uniqueidentifier] NOT NULL,
	[SolutionID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[PropertyTypeID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMPropertyType_AK1_AssemblyName_PropertyTypeName_SolutionID]
UNIQUE NONCLUSTERED
(
	[AssemblyName] ASC,
	[PropertyTypeName] ASC,
	[SolutionID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMAssembly]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMAssembly](
	[AssemblyID] [uniqueidentifier] NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[SolutionID] [uniqueidentifier] NOT NULL,
	[Description] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[AssemblyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMAssembly_AK1_Name_SolutionID] UNIQUE NONCLUSTERED
(
	[Name] ASC,
	[SolutionID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UITypeDefinition]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UITypeDefinition](
	[UITypeDefinitionID] [uniqueidentifier] NOT NULL,
	[AssemblyName] [varchar](50) NOT NULL,
	[TypeName] [varchar](50) NOT NULL,
	[SolutionID] [uniqueidentifier] NOT NULL,
	[TypeDescriminator] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[UITypeDefinitionID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT
[UITypeDefinition_UC1_AssemblyName_SolutionID_TypeDescriminator_TypeName]
UNIQUE NONCLUSTERED
(
	[AssemblyName] ASC,
	[SolutionID] ASC,
	[TypeDescriminator] ASC,
	[TypeName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridColumnControlType]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIGridColumnControlType](
	[UIGridColumnControlTypeID] [uniqueidentifier] NOT NULL,
	[AssemblyName] [varchar](50) NOT NULL,
	[TypeName] [varchar](50) NOT NULL,
	[SolutionID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIGridColumnControlTypeID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UIGridColumnControlType_AK1_AssemblyName_SolutionID_TypeName]
UNIQUE NONCLUSTERED
(
	[AssemblyName] ASC,
	[SolutionID] ASC,
	[TypeName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIControlMapperType]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIControlMapperType](
	[UIControlMapperTypeID] [uniqueidentifier] NOT NULL,
	[AssemblyName] [varchar](50) NULL,
	[TypeName] [varchar](50) NULL,
	[SolutionID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[UIControlMapperTypeID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UIControlMapperType_AK1_AssemblyName_SolutionID_TypeName]
UNIQUE NONCLUSTERED
(
	[AssemblyName] ASC,
	[SolutionID] ASC,
	[TypeName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIControlType]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIControlType](
	[AssemblyName] [varchar](50) NOT NULL,
	[TypeName] [varchar](50) NOT NULL,
	[UIControlTypeID] [uniqueidentifier] NOT NULL,
	[SolutionID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIControlTypeID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UIControlType_AK1_AssemblyName_SolutionID_TypeName] UNIQUE
NONCLUSTERED
(
	[AssemblyName] ASC,
	[SolutionID] ASC,
	[TypeName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UITab]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UITab](
	[UITabID] [uniqueidentifier] NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[Generated] [bit] NOT NULL,
	[UIFormID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UITabID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridFilterProp]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIGridFilterProp](
	[UIGridFilterPropID] [uniqueidentifier] NOT NULL,
	[UIGridFilterID] [uniqueidentifier] NOT NULL,
	[PropertyID] [uniqueidentifier] NOT NULL,
	[Generated] [bit] NOT NULL,
	[FilterControlTypeID] [uniqueidentifier] NOT NULL,
	[LabelText] [varchar](50) NULL,
	[DefaultValue] [varchar](50) NULL,
	[Nullable] [bit] NULL,
	[FilterClauseOp] [varchar](50) NULL,
	[OrdinalPosition] [int] NULL,
	[ToolTipText] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[UIGridFilterPropID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UIGridFilterProp_AK1_PropertyID_UIGridFilterID] UNIQUE
NONCLUSTERED
(
	[PropertyID] ASC,
	[UIGridFilterID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridColumnInfo]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIGridColumnInfo](
	[UIGridColumnID] [uniqueidentifier] NOT NULL,
	[Heading] [varchar](50) NULL,
	[PropertyID] [uniqueidentifier] NOT NULL,
	[UIGridColumnControlTypeID] [uniqueidentifier] NOT NULL,
	[Editable] [bit] NULL,
	[Width] [varchar](50) NULL,
	[Alignment] [varchar](50) NULL,
	[Generated] [bit] NOT NULL,
	[UIGridID] [uniqueidentifier] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIGridColumnID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIParameter]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIParameter](
	[UIParameterID] [uniqueidentifier] NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[Value] [varchar](50) NOT NULL,
	[Generated] [bit] NOT NULL,
	[UIFieldID] [uniqueidentifier] NULL,
	[UIColumnID] [uniqueidentifier] NULL,
	[UIGridFilterPropID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[UIParameterID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[ModelModification]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ModelModification](
	[ModelModificationID] [uniqueidentifier] NOT NULL,
	[Description] [varchar](50) NULL,
	[ReverseEngineeringID] [uniqueidentifier] NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[ModelModificationID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBKey]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBKey](
	[KeyID] [uniqueidentifier] NOT NULL,
	[KeyName] [varchar](50) NULL,
	[TableID] [uniqueidentifier] NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[KeyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBForeignKey]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBForeignKey](
	[ForeignKeyID] [uniqueidentifier] NOT NULL,
	[ParentTableID] [uniqueidentifier] NULL,
	[RelatedTableID] [uniqueidentifier] NULL,
	[ForeignKeyName] [varchar](50) NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[ForeignKeyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBColumn](
	[ColumnID] [uniqueidentifier] NOT NULL,
	[ColumnName] [varchar](50) NOT NULL,
	[DataType] [varchar](50) NOT NULL,
	[DataLength] [int] NULL,
	[Nullable] [bit] NOT NULL,
	[DefaultValue] [varchar](50) NULL,
	[TableID] [uniqueidentifier] NOT NULL,
	[IsAutoIncrementing] [bit] NULL,
	[Comment] [varchar](50) NULL,
	[OrdinalPosition] [int] NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[ColumnID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBKeyColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBKeyColumn](
	[ColumnID] [uniqueidentifier] NOT NULL,
	[KeyID] [uniqueidentifier] NOT NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[ColumnID] ASC,
	[KeyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBForeignKeyColumn]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBForeignKeyColumn](
	[ForeignKeyColumnID] [uniqueidentifier] NOT NULL,
	[ForeignKeyID] [uniqueidentifier] NULL,
	[ParentColumnID] [uniqueidentifier] NULL,
	[RelatedColumnID] [uniqueidentifier] NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[ForeignKeyColumnID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIView]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIView](
	[UIViewID] [uniqueidentifier] NOT NULL,
	[ViewName] [varchar](50) NOT NULL,
	[Generated] [bit] NOT NULL,
	[ClassID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIViewID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMSuperClass]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMSuperClass](
	[SuperClassID] [uniqueidentifier] NOT NULL,
	[SuperClassClassID] [uniqueidentifier] NOT NULL,
	[Identity] [varchar](50) NULL,
	[Discriminator] [varchar](50) NULL,
	[Generated] [bit] NOT NULL,
	[InheritanceType] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[SuperClassID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMUniqueConstraint]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMUniqueConstraint](
	[UniqueConstraintID] [uniqueidentifier] NOT NULL,
	[ClassID] [uniqueidentifier] NOT NULL,
	[Message] [varchar](50) NULL,
	[IgnoreIfNull] [bit] NOT NULL,
	[UniqueConstraintName] [varchar](50) NOT NULL,
	[Generated] [bit] NOT NULL,
	[MappedAlternateKeyID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[UniqueConstraintID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMRelationship]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMRelationship](
	[RelationshipID] [uniqueidentifier] NOT NULL,
	[OwnerClassID] [uniqueidentifier] NOT NULL,
	[RelationshipName] [varchar](50) NOT NULL,
	[Cardinality] [varchar](50) NOT NULL,
	[RelatedClassID] [uniqueidentifier] NOT NULL,
	[KeepReference] [bit] NULL,
	[OrderBy] [varchar](50) NULL,
	[DeleteAction] [varchar](50) NOT NULL,
	[Generated] [bit] NOT NULL,
	[RelationshipType] [varchar](50) NULL,
	[MappedForeignKeyID] [uniqueidentifier] NULL,
	[RelationshipDescription] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[RelationshipID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMObjectIdentity]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMObjectIdentity](
	[ObjectIdentityID] [uniqueidentifier] NOT NULL,
	[ClassID] [uniqueidentifier] NOT NULL,
	[IsObjectID] [bit] NOT NULL,
	[Generated] [bit] NOT NULL,
	[MappedPrimaryKeyID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[ObjectIdentityID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMProperty]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMProperty](
	[PropertyID] [uniqueidentifier] NOT NULL,
	[PropertyName] [varchar](50) NOT NULL,
	[ReadWriteRule] [varchar](50) NULL,
	[MappedDBColumnName] [varchar](50) NULL,
	[Description] [varchar](50) NULL,
	[Compulsory] [bit] NULL,
	[AutoIncrementing] [bit] NULL,
	[Length] [int] NULL,
	[KeepValuePrivate] [bit] NULL,
	[DisplayName] [varchar](50) NULL,
	[DefaultValue] [varchar](50) NULL,
	[ClassID] [uniqueidentifier] NOT NULL,
	[Generated] [bit] NOT NULL,
	[ObjectIdentityID] [uniqueidentifier] NULL,
	[LookupListID] [uniqueidentifier] NULL,
	[PropertyTypeID] [uniqueidentifier] NOT NULL,
	[MappedDBColumnID] [uniqueidentifier] NULL,
	[OrdinalPosition] [int] NOT NULL,
	[DefaultPropRuleID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[PropertyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMProperty_AK1_ClassID_PropertyName] UNIQUE NONCLUSTERED
(
	[ClassID] ASC,
	[PropertyName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMUniqueConstraintProperty]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMUniqueConstraintProperty](
	[UniqueConstraintPropertyID] [uniqueidentifier] NOT NULL,
	[PropertyID] [uniqueidentifier] NOT NULL,
	[UniqueConstraintID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UniqueConstraintPropertyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMUniqueConstraintProperty_PropertyID_UniqueConstraintID]
UNIQUE NONCLUSTERED
(
	[PropertyID] ASC,
	[UniqueConstraintID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMRelationshipProperty]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMRelationshipProperty](
	[RelationshipPropertyID] [uniqueidentifier] NOT NULL,
	[RelatedPropertyID] [uniqueidentifier] NOT NULL,
	[OwnerPropertyID] [uniqueidentifier] NOT NULL,
	[RelationshipID] [uniqueidentifier] NOT NULL,
	[Generated] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[RelationshipPropertyID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMRelationshipProperty_OwnerPropertyID_RelationshipID] UNIQUE
NONCLUSTERED
(
	[OwnerPropertyID] ASC,
	[RelationshipID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMRelationshipProperty_RelatedPropertyID_RelationshipID]
UNIQUE NONCLUSTERED
(
	[RelatedPropertyID] ASC,
	[RelationshipID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIField]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIField](
	[UIFieldID] [uniqueidentifier] NOT NULL,
	[LabelText] [varchar](50) NULL,
	[PropertyID] [uniqueidentifier] NULL,
	[RelationshipID] [uniqueidentifier] NULL,
	[UIControlTypeID] [uniqueidentifier] NOT NULL,
	[UIControlMapperTypeID] [uniqueidentifier] NULL,
	[Editable] [bit] NULL,
	[ToolTipText] [varchar](50) NULL,
	[Generated] [bit] NOT NULL,
	[UIColumnLayoutID] [uniqueidentifier] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIFieldID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DMClass](
	[ClassID] [uniqueidentifier] NOT NULL,
	[ClassNameBO] [varchar](100) NOT NULL,
	[MappedTableName] [varchar](50) NOT NULL,
	[AssemblyID] [uniqueidentifier] NOT NULL,
	[DisplayName] [varchar](50) NULL,
	[Generated] [bit] NULL,
	[SuperClassID] [uniqueidentifier] NULL,
	[MappedTableID] [uniqueidentifier] NULL,
	[ClassDescription] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
	[ClassID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DMClass_AK1_ClassNameBO] UNIQUE NONCLUSTERED
(
	[ClassNameBO] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[UIColumnLayout]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UIColumnLayout](
	[UIColumnLayoutID] [uniqueidentifier] NOT NULL,
	[Width] [int] NULL,
	[Generated] [bit] NOT NULL,
	[UITabID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[UIColumnLayoutID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[ReverseEngineering]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ReverseEngineering](
	[ReverseEngineeringID] [uniqueidentifier] NOT NULL,
	[DatabaseConnectionID] [uniqueidentifier] NULL,
	[StoredDatabaseID] [uniqueidentifier] NULL,
	[ReverseEngineeringSettingsID] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED
(
	[ReverseEngineeringID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[DBTable]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DBTable](
	[DateCreated] [datetime] NULL,
	[Owner] [varchar](50) NULL,
	[TableNameDB] [varchar](255) NOT NULL,
	[TableID] [uniqueidentifier] NOT NULL,
	[DatabaseID] [uniqueidentifier] NOT NULL,
	[TableType] [varchar](50) NULL,
	[TableComment] [varchar](50) NULL,
	[CreateTime] [datetime] NULL,
	[UpdateTime] [datetime] NULL,
	[PendingChangeType] [varchar](50) NULL,
	[Approved] [bit] NULL,
PRIMARY KEY CLUSTERED
(
	[TableID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [DBTable_AK1_DatabaseID_TableNameDB] UNIQUE NONCLUSTERED
(
	[DatabaseID] ASC,
	[TableNameDB] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBColumn_DBPrimaryKeyColumn_FK_Column]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBPrimaryKeyColumn]'))
ALTER TABLE [dbo].[DBPrimaryKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBColumn_DBPrimaryKeyColumn_FK_Column] FOREIGN KEY([ColumnID])
REFERENCES [dbo].[DBColumn] ([ColumnID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBPrimaryKey_DBPrimaryKeyColumn_FK_PrimaryKeyDB]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBPrimaryKeyColumn]'))
ALTER TABLE [dbo].[DBPrimaryKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBPrimaryKey_DBPrimaryKeyColumn_FK_PrimaryKeyDB] FOREIGN
KEY([PrimaryKeyID])
REFERENCES [dbo].[DBPrimaryKey] ([PrimaryKeyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBPrimaryKeyColumn_PrimaryKeyDB]') AND parent_object_id
= OBJECT_ID(N'[dbo].[DBPrimaryKeyColumn]'))
ALTER TABLE [dbo].[DBPrimaryKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBPrimaryKeyColumn_PrimaryKeyDB] FOREIGN KEY([PrimaryKeyID])
REFERENCES [dbo].[DBPrimaryKey] ([PrimaryKeyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMLookupListSimple_DMListItem_FK_LookupListSimple]')
AND parent_object_id = OBJECT_ID(N'[dbo].[DMListItem]'))
ALTER TABLE [dbo].[DMListItem]  WITH NOCHECK ADD  CONSTRAINT
[DMLookupListSimple_DMListItem_FK_LookupListSimple] FOREIGN
KEY([SimpleLookupListID])
REFERENCES [dbo].[DMLookupListSimple] ([SimpleLookupListID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMPropRule_DMPropRuleParameter_FK_PropRule]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMPropRuleParameter]'))
ALTER TABLE [dbo].[DMPropRuleParameter]  WITH NOCHECK ADD  CONSTRAINT
[DMPropRule_DMPropRuleParameter_FK_PropRule] FOREIGN KEY([PropRuleID])
REFERENCES [dbo].[DMPropRule] ([PropRuleID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution_DMPropertyType_FK_Solution]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMPropertyType]'))
ALTER TABLE [dbo].[DMPropertyType]  WITH NOCHECK ADD  CONSTRAINT
[DMSolution_DMPropertyType_FK_Solution] FOREIGN KEY([SolutionID])
REFERENCES [dbo].[DMSolution] ([SolutionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution_DMAssembly_FK_Solution]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMAssembly]'))
ALTER TABLE [dbo].[DMAssembly]  WITH NOCHECK ADD  CONSTRAINT
[DMSolution_DMAssembly_FK_Solution] FOREIGN KEY([SolutionID])
REFERENCES [dbo].[DMSolution] ([SolutionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution_UITypeDefinition_FK_DMSolution_1]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UITypeDefinition]'))
ALTER TABLE [dbo].[UITypeDefinition]  WITH NOCHECK ADD  CONSTRAINT
[DMSolution_UITypeDefinition_FK_DMSolution_1] FOREIGN KEY([SolutionID])
REFERENCES [dbo].[DMSolution] ([SolutionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution_UIGridColumnControlType_FK_Solution]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIGridColumnControlType]'))
ALTER TABLE [dbo].[UIGridColumnControlType]  WITH NOCHECK ADD  CONSTRAINT
[DMSolution_UIGridColumnControlType_FK_Solution] FOREIGN KEY([SolutionID])
REFERENCES [dbo].[DMSolution] ([SolutionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution_UIControlMapperType_FK_Solution]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIControlMapperType]'))
ALTER TABLE [dbo].[UIControlMapperType]  WITH NOCHECK ADD  CONSTRAINT
[DMSolution_UIControlMapperType_FK_Solution] FOREIGN KEY([SolutionID])
REFERENCES [dbo].[DMSolution] ([SolutionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMSolution_UIControlType_FK_Solution]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIControlType]'))
ALTER TABLE [dbo].[UIControlType]  WITH NOCHECK ADD  CONSTRAINT
[DMSolution_UIControlType_FK_Solution] FOREIGN KEY([SolutionID])
REFERENCES [dbo].[DMSolution] ([SolutionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIFormInfo_UITab_FK_UIFormInfo]') AND parent_object_id
= OBJECT_ID(N'[dbo].[UITab]'))
ALTER TABLE [dbo].[UITab]  WITH NOCHECK ADD  CONSTRAINT
[UIFormInfo_UITab_FK_UIFormInfo] FOREIGN KEY([UIFormID])
REFERENCES [dbo].[UIFormInfo] ([UIFormID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMProperty_UIGridFilterProp_FK_Property]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIGridFilterProp]'))
ALTER TABLE [dbo].[UIGridFilterProp]  WITH NOCHECK ADD  CONSTRAINT
[DMProperty_UIGridFilterProp_FK_Property] FOREIGN KEY([PropertyID])
REFERENCES [dbo].[DMProperty] ([PropertyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridFilter_UIGridFilterProp_FK_UIGridFilter]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIGridFilterProp]'))
ALTER TABLE [dbo].[UIGridFilterProp]  WITH NOCHECK ADD  CONSTRAINT
[UIGridFilter_UIGridFilterProp_FK_UIGridFilter] FOREIGN
KEY([UIGridFilterID])
REFERENCES [dbo].[UIGridFilter] ([UIGridFilterID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UITypeDefinition_UIGridFilterProp_FK_UIGridFilterType]')
AND parent_object_id = OBJECT_ID(N'[dbo].[UIGridFilterProp]'))
ALTER TABLE [dbo].[UIGridFilterProp]  WITH NOCHECK ADD  CONSTRAINT
[UITypeDefinition_UIGridFilterProp_FK_UIGridFilterType] FOREIGN
KEY([FilterControlTypeID])
REFERENCES [dbo].[UITypeDefinition] ([UITypeDefinitionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMProperty_UIGridColumnInfo_FK_Property]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIGridColumnInfo]'))
ALTER TABLE [dbo].[UIGridColumnInfo]  WITH NOCHECK ADD  CONSTRAINT
[DMProperty_UIGridColumnInfo_FK_Property] FOREIGN KEY([PropertyID])
REFERENCES [dbo].[DMProperty] ([PropertyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridColumnControlType_UIGridColumnInfo_FK_UIGridColumnControlType]')
AND parent_object_id = OBJECT_ID(N'[dbo].[UIGridColumnInfo]'))
ALTER TABLE [dbo].[UIGridColumnInfo]  WITH NOCHECK ADD  CONSTRAINT
[UIGridColumnControlType_UIGridColumnInfo_FK_UIGridColumnControlType]
FOREIGN KEY([UIGridColumnControlTypeID])
REFERENCES [dbo].[UIGridColumnControlType] ([UIGridColumnControlTypeID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridInfo_UIGridColumnInfo_FK_UIGrid]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIGridColumnInfo]'))
ALTER TABLE [dbo].[UIGridColumnInfo]  WITH NOCHECK ADD  CONSTRAINT
[UIGridInfo_UIGridColumnInfo_FK_UIGrid] FOREIGN KEY([UIGridID])
REFERENCES [dbo].[UIGridInfo] ([UIGridID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIField_UIParameter_FK_UIField]') AND parent_object_id
= OBJECT_ID(N'[dbo].[UIParameter]'))
ALTER TABLE [dbo].[UIParameter]  WITH NOCHECK ADD  CONSTRAINT
[UIField_UIParameter_FK_UIField] FOREIGN KEY([UIFieldID])
REFERENCES [dbo].[UIField] ([UIFieldID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridColumnInfo_UIParameter_FK_UIGridColumnInfo]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIParameter]'))
ALTER TABLE [dbo].[UIParameter]  WITH NOCHECK ADD  CONSTRAINT
[UIGridColumnInfo_UIParameter_FK_UIGridColumnInfo] FOREIGN
KEY([UIColumnID])
REFERENCES [dbo].[UIGridColumnInfo] ([UIGridColumnID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIGridFilterProp_UIParameter_FK_UIGridFilterProp]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIParameter]'))
ALTER TABLE [dbo].[UIParameter]  WITH NOCHECK ADD  CONSTRAINT
[UIGridFilterProp_UIParameter_FK_UIGridFilterProp] FOREIGN
KEY([UIGridFilterPropID])
REFERENCES [dbo].[UIGridFilterProp] ([UIGridFilterPropID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[ModelModification_ReverseEngineering]') AND
parent_object_id = OBJECT_ID(N'[dbo].[ModelModification]'))
ALTER TABLE [dbo].[ModelModification]  WITH NOCHECK ADD  CONSTRAINT
[ModelModification_ReverseEngineering] FOREIGN KEY([ReverseEngineeringID])
REFERENCES [dbo].[ReverseEngineering] ([ReverseEngineeringID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[ReverseEngineering_ModelModification_FK_ReverseEngineering]')
AND parent_object_id = OBJECT_ID(N'[dbo].[ModelModification]'))
ALTER TABLE [dbo].[ModelModification]  WITH NOCHECK ADD  CONSTRAINT
[ReverseEngineering_ModelModification_FK_ReverseEngineering] FOREIGN
KEY([ReverseEngineeringID])
REFERENCES [dbo].[ReverseEngineering] ([ReverseEngineeringID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBTable_DBKey_FK_Table]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DBKey]'))
ALTER TABLE [dbo].[DBKey]  WITH NOCHECK ADD  CONSTRAINT
[DBTable_DBKey_FK_Table] FOREIGN KEY([TableID])
REFERENCES [dbo].[DBTable] ([TableID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBTable_DBForeignKey_FK_ParentTable]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBForeignKey]'))
ALTER TABLE [dbo].[DBForeignKey]  WITH NOCHECK ADD  CONSTRAINT
[DBTable_DBForeignKey_FK_ParentTable] FOREIGN KEY([ParentTableID])
REFERENCES [dbo].[DBTable] ([TableID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBTable_DBForeignKey_FK_RelatedTable]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBForeignKey]'))
ALTER TABLE [dbo].[DBForeignKey]  WITH NOCHECK ADD  CONSTRAINT
[DBTable_DBForeignKey_FK_RelatedTable] FOREIGN KEY([RelatedTableID])
REFERENCES [dbo].[DBTable] ([TableID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBTable_DBColumn_FK_Table]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DBColumn]'))
ALTER TABLE [dbo].[DBColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBTable_DBColumn_FK_Table] FOREIGN KEY([TableID])
REFERENCES [dbo].[DBTable] ([TableID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBColumn_DBKeyColumn_FK_Column]') AND parent_object_id
= OBJECT_ID(N'[dbo].[DBKeyColumn]'))
ALTER TABLE [dbo].[DBKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBColumn_DBKeyColumn_FK_Column] FOREIGN KEY([ColumnID])
REFERENCES [dbo].[DBColumn] ([ColumnID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBKey_DBKeyColumn_FK_Key]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DBKeyColumn]'))
ALTER TABLE [dbo].[DBKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBKey_DBKeyColumn_FK_Key] FOREIGN KEY([KeyID])
REFERENCES [dbo].[DBKey] ([KeyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBKeyColumn_Key]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DBKeyColumn]'))
ALTER TABLE [dbo].[DBKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBKeyColumn_Key] FOREIGN KEY([KeyID])
REFERENCES [dbo].[DBKey] ([KeyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBColumn_DBForeignKeyColumn_FK_ParentColumn]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBForeignKeyColumn]'))
ALTER TABLE [dbo].[DBForeignKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBColumn_DBForeignKeyColumn_FK_ParentColumn] FOREIGN
KEY([ParentColumnID])
REFERENCES [dbo].[DBColumn] ([ColumnID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBColumn_DBForeignKeyColumn_FK_RelatedColumn]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBForeignKeyColumn]'))
ALTER TABLE [dbo].[DBForeignKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBColumn_DBForeignKeyColumn_FK_RelatedColumn] FOREIGN
KEY([RelatedColumnID])
REFERENCES [dbo].[DBColumn] ([ColumnID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBForeignKey_DBForeignKeyColumn_FK_ForeignKey]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DBForeignKeyColumn]'))
ALTER TABLE [dbo].[DBForeignKeyColumn]  WITH NOCHECK ADD  CONSTRAINT
[DBForeignKey_DBForeignKeyColumn_FK_ForeignKey] FOREIGN
KEY([ForeignKeyID])
REFERENCES [dbo].[DBForeignKey] ([ForeignKeyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass_UIView_FK_Class]') AND parent_object_id =
OBJECT_ID(N'[dbo].[UIView]'))
ALTER TABLE [dbo].[UIView]  WITH NOCHECK ADD  CONSTRAINT
[DMClass_UIView_FK_Class] FOREIGN KEY([ClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass_DMSuperClass_FK_SuperClassClass]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMSuperClass]'))
ALTER TABLE [dbo].[DMSuperClass]  WITH NOCHECK ADD  CONSTRAINT
[DMClass_DMSuperClass_FK_SuperClassClass] FOREIGN KEY([SuperClassClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass_DMUniqueConstraint_FK_Class]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMUniqueConstraint]'))
ALTER TABLE [dbo].[DMUniqueConstraint]  WITH NOCHECK ADD  CONSTRAINT
[DMClass_DMUniqueConstraint_FK_Class] FOREIGN KEY([ClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass_DMRelationship_FK_OwnerClass]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMRelationship]'))
ALTER TABLE [dbo].[DMRelationship]  WITH NOCHECK ADD  CONSTRAINT
[DMClass_DMRelationship_FK_OwnerClass] FOREIGN KEY([OwnerClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass_DMRelationship_FK_RelatedClass]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMRelationship]'))
ALTER TABLE [dbo].[DMRelationship]  WITH NOCHECK ADD  CONSTRAINT
[DMClass_DMRelationship_FK_RelatedClass] FOREIGN KEY([RelatedClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[FK_DMRelationship_DMClass]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DMRelationship]'))
ALTER TABLE [dbo].[DMRelationship]  WITH NOCHECK ADD  CONSTRAINT
[FK_DMRelationship_DMClass] FOREIGN KEY([OwnerClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[FK_DMRelationship_DMClass1]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DMRelationship]'))
ALTER TABLE [dbo].[DMRelationship]  WITH NOCHECK ADD  CONSTRAINT
[FK_DMRelationship_DMClass1] FOREIGN KEY([RelatedClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[FK_DMObjectIdentity_DMClass]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DMObjectIdentity]'))
ALTER TABLE [dbo].[DMObjectIdentity]  WITH NOCHECK ADD  CONSTRAINT
[FK_DMObjectIdentity_DMClass] FOREIGN KEY([ClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMClass_DMProperty_FK_Class]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DMProperty]'))
ALTER TABLE [dbo].[DMProperty]  WITH NOCHECK ADD  CONSTRAINT
[DMClass_DMProperty_FK_Class] FOREIGN KEY([ClassID])
REFERENCES [dbo].[DMClass] ([ClassID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMObjectIdentity_DMProperty_FK_ObjectIdentity]') AND
parent_object_id = OBJECT_ID(N'[dbo].[DMProperty]'))
ALTER TABLE [dbo].[DMProperty]  WITH NOCHECK ADD  CONSTRAINT
[DMObjectIdentity_DMProperty_FK_ObjectIdentity] FOREIGN
KEY([ObjectIdentityID])
REFERENCES [dbo].[DMObjectIdentity] ([ObjectIdentityID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[FK_DMProperty_DMObjectIdentity]') AND parent_object_id
= OBJECT_ID(N'[dbo].[DMProperty]'))
ALTER TABLE [dbo].[DMProperty]  WITH NOCHECK ADD  CONSTRAINT
[FK_DMProperty_DMObjectIdentity] FOREIGN KEY([ObjectIdentityID])
REFERENCES [dbo].[DMObjectIdentity] ([ObjectIdentityID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[FK_DMProperty_DMPropertyType]') AND parent_object_id =
OBJECT_ID(N'[dbo].[DMProperty]'))
ALTER TABLE [dbo].[DMProperty]  WITH NOCHECK ADD  CONSTRAINT
[FK_DMProperty_DMPropertyType] FOREIGN KEY([PropertyTypeID])
REFERENCES [dbo].[DMPropertyType] ([PropertyTypeID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMProperty_DMUniqueConstraintProperty_FK_Property]')
AND parent_object_id = OBJECT_ID(N'[dbo].[DMUniqueConstraintProperty]'))
ALTER TABLE [dbo].[DMUniqueConstraintProperty]  WITH NOCHECK ADD 
CONSTRAINT [DMProperty_DMUniqueConstraintProperty_FK_Property] FOREIGN
KEY([PropertyID])
REFERENCES [dbo].[DMProperty] ([PropertyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMUniqueConstraint_DMUniqueConstraintProperty_FK_UniqueConstraint]')
AND parent_object_id = OBJECT_ID(N'[dbo].[DMUniqueConstraintProperty]'))
ALTER TABLE [dbo].[DMUniqueConstraintProperty]  WITH NOCHECK ADD 
CONSTRAINT
[DMUniqueConstraint_DMUniqueConstraintProperty_FK_UniqueConstraint]
FOREIGN KEY([UniqueConstraintID])
REFERENCES [dbo].[DMUniqueConstraint] ([UniqueConstraintID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMRelationship_DMRelationshipProperty_FK_Relationship]')
AND parent_object_id = OBJECT_ID(N'[dbo].[DMRelationshipProperty]'))
ALTER TABLE [dbo].[DMRelationshipProperty]  WITH NOCHECK ADD  CONSTRAINT
[DMRelationship_DMRelationshipProperty_FK_Relationship] FOREIGN
KEY([RelationshipID])
REFERENCES [dbo].[DMRelationship] ([RelationshipID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMProperty_UIField_FK_Property]') AND parent_object_id
= OBJECT_ID(N'[dbo].[UIField]'))
ALTER TABLE [dbo].[UIField]  WITH NOCHECK ADD  CONSTRAINT
[DMProperty_UIField_FK_Property] FOREIGN KEY([PropertyID])
REFERENCES [dbo].[DMProperty] ([PropertyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIColumnLayout_UIField_FK_UIColumnLayout]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIField]'))
ALTER TABLE [dbo].[UIField]  WITH NOCHECK ADD  CONSTRAINT
[UIColumnLayout_UIField_FK_UIColumnLayout] FOREIGN KEY([UIColumnLayoutID])
REFERENCES [dbo].[UIColumnLayout] ([UIColumnLayoutID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIControlMapperType_UIField_FK_UIControlMapperType]')
AND parent_object_id = OBJECT_ID(N'[dbo].[UIField]'))
ALTER TABLE [dbo].[UIField]  WITH NOCHECK ADD  CONSTRAINT
[UIControlMapperType_UIField_FK_UIControlMapperType] FOREIGN
KEY([UIControlMapperTypeID])
REFERENCES [dbo].[UIControlMapperType] ([UIControlMapperTypeID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UIControlType_UIField_FK_UIControlType]') AND
parent_object_id = OBJECT_ID(N'[dbo].[UIField]'))
ALTER TABLE [dbo].[UIField]  WITH NOCHECK ADD  CONSTRAINT
[UIControlType_UIField_FK_UIControlType] FOREIGN KEY([UIControlTypeID])
REFERENCES [dbo].[UIControlType] ([UIControlTypeID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DMAssembly_DMClass_FK_Assembly]') AND parent_object_id
= OBJECT_ID(N'[dbo].[DMClass]'))
ALTER TABLE [dbo].[DMClass]  WITH NOCHECK ADD  CONSTRAINT
[DMAssembly_DMClass_FK_Assembly] FOREIGN KEY([AssemblyID])
REFERENCES [dbo].[DMAssembly] ([AssemblyID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[UITab_UIColumnLayout_FK_UITab]') AND parent_object_id =
OBJECT_ID(N'[dbo].[UIColumnLayout]'))
ALTER TABLE [dbo].[UIColumnLayout]  WITH NOCHECK ADD  CONSTRAINT
[UITab_UIColumnLayout_FK_UITab] FOREIGN KEY([UITabID])
REFERENCES [dbo].[UITab] ([UITabID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DatabaseConnectionInfo_ReverseEngineering_FK_DatabaseConnectionInfo]')
AND parent_object_id = OBJECT_ID(N'[dbo].[ReverseEngineering]'))
ALTER TABLE [dbo].[ReverseEngineering]  WITH NOCHECK ADD  CONSTRAINT
[DatabaseConnectionInfo_ReverseEngineering_FK_DatabaseConnectionInfo]
FOREIGN KEY([DatabaseConnectionID])
REFERENCES [dbo].[DatabaseConnectionInfo] ([DatabaseConnectionID])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =
OBJECT_ID(N'[dbo].[DBDatabase_DBTable_FK_Database]') AND parent_object_id
= OBJECT_ID(N'[dbo].[DBTable]'))
ALTER TABLE [dbo].[DBTable]  WITH NOCHECK ADD  CONSTRAINT
[DBDatabase_DBTable_FK_Database] FOREIGN KEY([DatabaseID])
REFERENCES [dbo].[DBDatabase] ([DatabaseID])
